Continuous Integration

The Problem
Keeping diagrams up-to-date is essential to ensure they remain useful and accurate. Outdated diagrams can complicate knowledge transfer or troubleshooting sessions, potentially leading to confusion.
However, regularly updating diagrams can be time-consuming and require significant effort.
Automating diagram updates can help reduce this effort, ensuring both accuracy and consistency.
The Solution
In addition to the hooks feature, you might consider using the Mina CLI to streamline automation tasks.
Recapping the example described in the Mina CLI documentation: let's say you have a repository named infra-code
containing information about infrastructure systems, such as names, technologies, and other relevant details. These details are then used in your Keadex Mina project, which is stored in a repository called arch-diagrams
.
By integrating the CLI into a CI workflow within the infra-code
repository, you can automate updates to your Mina diagrams, keeping them consistently accurate without requiring manual changes.
Below is an example GitHub Workflow you could set up in the infra-code
repository to achieve this.
GitHub Worflow
.github/workflows/update-diagrams.yml
name: 'Update Architectural Diagrams Workflow'
on:
push:
branches:
- main
jobs:
update-diagrams:
permissions:
contents: write
runs-on: ubuntu-latest
steps:
# This step is just an example. You might need to replace this step with a more
# complex logic to retrieve updated data of your system(s).
- name: 'Retrieve updated web application technology'
id: 'retrieve_technology'
run: |
echo "web_app_alias=webapp" >> $GITHUB_OUTPUT
echo "web_app_tech=Nextjs" >> $GITHUB_OUTPUT
# Checkout the repo containing the Mina project.
- name: checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
repository: keadex/demo-mina
path: ./mina-project
ref: main
token: ${{ secrets.GITHUB_TOKEN }}
# Download the Mina CLI.
- name: download Mina CLI
run: |
curl -L -O https://github.com/keadex/keadex/releases/download/mina-cli%402.0.0/mina-cli-Linux-gnu-x86_64.tar.gz
tar -xf mina-cli-Linux-gnu-x86_64.tar.gz
# Use the Mina CLI to update the library element and any diagrams that reference it.
# This ensures that updates made to library elements propagate throughout all dependent diagrams,
# keeping them accurate and consistent.
- name: update library element and diagrams
run: ./mina-cli --project-path ./mina-project update-container --alias ${{steps.retrieve_technology.outputs.web_app_alias}} --new-technology ${{steps.retrieve_technology.outputs.web_app_tech}}
# Commit and push the changes to the Mina project repo
- name: commit and push changes
uses: EndBug/add-and-commit@v9
with:
cwd: './mina-project'
message: 'Updated library and architectural diagrams'